#ifndef _CCGIS_CHAR_POLYGON_H_
#define _CCGIS_CHAR_POLYGON_H_


#include "afxtempl.h"

namespace ccgis
{
#define MAXGY 5
#define MAXMAXGY 8 /* related to MAXVECTORS */
#define MAXVECTORS 257  /* must be at least 257  = (2 ^ MAXMAXGY) + 1  */
typedef struct  {			// definition of QSpline data points
    POINT ptfxStartPt;		// structure
    POINT ptfxCntlPt;
    POINT ptfxEndPt;
} QS;

typedef QS  *LPQS;

typedef POINT	far *LPPOINT;

#define PIXELSIZE 64 /* number of units per pixel. It has to be a power of two */
#define PIXSHIFT   6 /* should be 2log of PIXELSIZE */
#define ERRDIV     16 /* maximum error is  (pixel/ERRDIV) */
#define ERRSHIFT 4  /* = 2log(ERRDIV), define only if ERRDIV is a power of 2 */
#define ONE 0x40            /* constants for 26.6 arithmetic */
#define HALF 0x20
#define HALFM 0x1f

// Convert degrees to radians for math functions.
#define RAD(x) ((x) * 3.1415927 / 180)

class  CharPolygon : public CObject
{
	
public:    
	
	virtual ~CharPolygon();
	CharPolygon();  
    
	POINT pt[500];
    int count[50];
	float scale;
	int interval;
    WORD cCurves;	// Number of curves in polypolygon.

	FIXED FixedFromDouble(double d);
	int IntFromFixed(FIXED f);
	FIXED fxDiv2(FIXED fxVal1, FIXED fxVal2);
	void MakeRotationMat(LPMAT2 lpMat, double dAngle);
	void ShearMat(LPMAT2 lpMat);
	void IdentityMat(LPMAT2 lpMat);
	int  QSpline2Polyline(LPPOINT lpptPolygon, LPPOINTFX lppfSpline);
	int QSpline2Polyline(LPPOINT lpptBuffer, LPQS lpqsPoints, int inGY, unsigned int far *count, int nAscent);
    void initialFont(HDC);
	BOOL PolygonofChar(HDC hdc,short letter); 
	void DrawT2Outline(HDC hDC, LPTTPOLYGONHEADER lpHeader, DWORD size) ;
};

}

#endif//_CCGIS_CHAR_POLYGON_H_